package com.chen.service.Impl;

;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chen.common.Result;
import com.chen.mapper.MessageMapper;
import com.chen.pojo.Message;
import com.chen.service.MessageService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;


@Service("messageServiceImpl")
@SuppressWarnings("all")
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
    @Resource
    private MessageMapper messageMapper;



    /**
     * 更新留言
     *
     * @param Message
     * @return
     */
    public Result<?> update(Message Message) {
        return Result.success(messageMapper.updateById(Message));
    }

    /**
     * 删除留言
     *
     * @param id
     * @return
     */
    public Result<?> delete(Long id) {
        messageMapper.deleteById(id);
        return Result.success();
    }

    /**
     * 查找留言
     *
     * @param id
     * @return
     */
    public Result<?> findById(Long id) {
        return Result.success(messageMapper.selectById(id));
    }

    /**
     * 查询所有留言
     *
     * @return
     */
    public Result<?> findAll() {
        return Result.success(messageMapper.selectList(null));
    }


    @Override
    public List<Message> findCommit() {
        return messageMapper.findCommit();
    }
}
